package com.ww.util.excel.easyexcel.listener;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.ww.util.excel.easyexcel.model.DemoData;

import java.io.File;

public class TestDemo {

    public static void main(String[] args) {
        File testExcel = new File("D:/test/easyexcel/demo.xlsx");

        // 一个文件一个reader
        try (ExcelReader excelReader = EasyExcel.read(testExcel, DemoData.class, new DemoDataListener()).build()) {
            // 指定sheet名字或编号
            ReadSheet readSheet = EasyExcel.readSheet(0).build();
            // 读数据
            excelReader.read(readSheet);
        }
    }
}
